-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fade out unnecessary usings #2646
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2646 +/- ##
=========================================
+ Coverage 65.27% 65.4% +0.13%
=========================================
Files 99 99
Lines 4320 4371 +51
Branches 630 641 +11
=========================================
+ Hits 2820 2859 +39
- Misses 1313 1325 +12
Partials 187 187
Continue to review full report at Codecov.
|
@@ -325,7 +325,14 @@ class DiagnosticsProvider extends AbstractSupport { | |||
private static _asDiagnostic(quickFix: protocol.QuickFix): vscode.Diagnostic { | |||
let severity = DiagnosticsProvider._asDiagnosticSeverity(quickFix.LogLevel); | |||
let message = `${quickFix.Text} [${quickFix.Projects.map(n => DiagnosticsProvider._asProjectLabel(n)).join(', ')}]`; | |||
return new vscode.Diagnostic(toRange(quickFix), message, severity); | |||
let diagnostic = new vscode.Diagnostic(toRange(quickFix), message, severity); | |||
if(diagnostic.message.includes("Unnecessary using directive")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of a hack. Roslyn has analyzers that will fade all sorts of unused things, so it might be nice to properly flow that information from omnisharp so we can fade everything...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that sounds right. Will look into it.
Any update on this? |
I played this feature little: Theres Descriptor.CustomTags field on diagnostic that has value 'Unnecessary' when diagnostic should be faded out. Updated omnishar-roslyn code (locally) with savpek/omnisharp-roslyn@a29348c However CS0xxx diagnostics don't have that 'unnecessary' tag field, it is included only on roslyn analysis diagnostics (dunno why?). It seems very common that theres specific 'hidden' diagnostics with 'unnesessary' tag which only purpose is to fadeout parts of code. Like that IDE0035 in image. In image theres hard coded CS0xxx codes to only fadeout items (CS0162, CS8019) and not show squiggle under text. They are unnecessary usings and unreachable code. I liked that look much better 😄 There may be better generic way to solve this, since there's IDE analysis that tells to hide those lines. However CS diagnostic adds squiggles since it don't have tags but i don't know how to solve that which IDE analysis is meant to hide certain CS analysis in which locations. Without that bit hacky hardcoding certain CS diagnostics result looks like: Where CS0162 adds squiggle and IDE035 fadeouts code. I can link omnisharp-vscode side of code later this week here if needed used at this prototype. |
Updates? |
@Ciberusps The relevant changes are already in OmniSharp and we will be working on consuming the new omnisharp version. It should be available soon. |
I will close this PR in favor of #2873 |
Related issue: #1179
#1245
Related API: microsoft/vscode#20219
https://code.visualstudio.com/updates/v1_25#_diagnostictag
Fade the unnecessary usings